package com.service.impl;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.dao.StaffMapper;
import com.model.Staff;
import com.service.IStaffService;

@Service("staffService")
public class StaffServiceImpl implements IStaffService {
	@Resource
	private StaffMapper staffMapper;

	public Staff getStaffById(Integer id) {
		return staffMapper.selectByPrimaryKey(id);
	}

	public int saveStaff(Staff u) {
		int i = staffMapper.insertSelective(u);
		return i;
	}

	public List<Staff> findAll(Map<Object, Object> map) {
		List<Staff> list = staffMapper.selectAllStaffs(map);
		return list;
	}

	public int updateStaff(Staff u) {
		int i = staffMapper.updateByPrimaryKeySelective(u);
		return i;
	}

	public int countStaffs() {
		return staffMapper.countStaffs();
	}

	public Staff selectByUsernameAndPassword(Map<Object, Object> map){
		return staffMapper.selectByUsernameAndPassword(map);
	}

}
